#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

class A
{
public:
	virtual void func1()
	{
		cout << "A::func1() " << endl;
	}

	virtual void func2()
	{
		cout << "A::func2() " << endl;
	}
};

class B : public A
{
public:
	virtual void func1()
	{
		cout << "B::func1() " << endl;
	}
};

class Base1 {
public:
	virtual void func1() { cout << "Base1::func1" << endl; }
	virtual void func2() { cout << "Base1::func2" << endl; }
private:
	int b1;
};

class Base2 {
public:
	virtual void func1() { cout << "Base2::func1" << endl; }
	virtual void func2() { cout << "Base2::func2" << endl; }
private:
	int b2;
};

class Derive : public Base1 {
public:
	virtual void func1() { cout << "Derive::func1" << endl; }
	//virtual void func3() { cout << "Derive::func3" << endl; }
private:
	int d1;
};

typedef void(*VF_PTR)();

void PrintVFT(VF_PTR * ptr)
{
	for (int i = 0; ptr[i] != nullptr; i++)
	{
		printf("[%d] : %p->",i, ptr[i]);
		VF_PTR f = ptr[i];
		f();
	}
	cout << endl;
}

int main()
{
	B b;
	PrintVFT((VF_PTR*)(*((int*)&b)));

	//Derive d;
	//PrintVFT((VF_PTR*)(*((int*)&d)));
	return 0;
}